﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using COFE.Core.Lister;
using COFE.Core;
using COFE.Core.Entry;

namespace COFE.Core.Actions
{
    /// <summary>
    /// Convert all IFileSystemInfo's GetCOFEProperty()/IsPropertySupported() request to OneEntryList's.
    /// </summary>
    public class EntryToOneEntryListPropertyProvider : ISecondaryPropertyProvider<IFileSystemInfo>
    {
        public object[] GetSupportedProperty(IFileSystemInfo sourceObj)
        {
            var list = new OneEntryList(sourceObj);
            return list.GetSupportedProperty(PropertyRetrivalOptions.NotApplied);            
        }

        public bool IsPropertyReadOnly(IFileSystemInfo sourceObj, object property)
        {
            var list = new OneEntryList(sourceObj);
            return list.IsPropertySupported(property, PropertyRetrivalOptions.NotApplied);            
        }

        public PropertyPair GetProperty(IFileSystemInfo sourceObj, object property)
        {
            var list = new OneEntryList(sourceObj);
            return list.GetProperty(property, PropertyRetrivalOptions.NotApplied);            
        }

        public void SetProperty(IFileSystemInfo sourceObj, object property, object value)
        {
            throw new NotSupportedException();
        }
    }
}
